package net.openvision.music.ui;

import java.awt.Color;
import java.awt.Graphics;
import java.awt.Rectangle;

import javax.swing.JComponent;
import javax.swing.border.EmptyBorder;
import javax.swing.plaf.ComponentUI;

public class BasicMusicScoreUI extends MusicScoreUI {

	private JMusicScore musicScore;

	public static ComponentUI createUI(JComponent c) {
		return new BasicMusicScoreUI();
	}

	public void installUI(JComponent c) {
		this.musicScore = (JMusicScore) c;
		installDefaults();
		installComponents();
		installListeners();

		c.setBackground(Color.WHITE);
		c.setLayout(null); // the default layout
		c.setBorder(new EmptyBorder(1, 1, 1, 1)); // the default Border
	}

	public void uninstallUI(JComponent c) {
		c.setLayout(null);
		uninstallListeners();
		uninstallComponents();
		uninstallDefaults();

		this.musicScore = null;
	}

	public void installDefaults() {

	}

	public void installComponents() {
	}

	public void installListeners() {

	}

	public void uninstallDefaults() {

	}

	public void uninstallComponents() {

	}

	public void uninstallListeners() {

	}

//	@Override
//	public void paint(Graphics g, JComponent c) {
//		super.paint(g, c);
//	}

	private void drawStaffLines(Graphics g, Rectangle r) {
		int height = r.height / 5;
		for (int i = 0; i < 5; i++) {
			g.setColor(Color.BLACK);
			g.drawLine(r.x, r.y + i * height, r.x + r.width, r.y + i * height);
		}
	}
}
